package com.aloda.ojjudge.codesandbox.impl;

import com.aloda.ojcommon.domain.enums.JudgeInfoMessageEnum;
import com.aloda.ojcommon.domain.enums.QuestionSubmitStatusEnum;
import com.aloda.ojjudge.codesandbox.CodeSandbox;
import com.aloda.ojjudge.pojo.dto.ExecuteCodeRequest;
import com.aloda.ojjudge.pojo.dto.ExecuteCodeResponse;
import com.aloda.ojcommon.domain.entity.JudgeInfo;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author aloda
 * @Date 2025/4/29 15:32
 */
@Component
public class ExampleCodeSandbox implements CodeSandbox {

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        executeCodeResponse.setJudgeInfo(judgeInfo);
        return executeCodeResponse;
    }

}
